package com.ghn.cocknovel.ui.activity.setting

import android.os.Bundle
import android.text.TextUtils
import com.example.basemodel.base.BaseHeadVMActivity
import com.example.basemodel.base.DefaultHeadStyle
import com.ghn.cocknovel.R
import com.ghn.cocknovel.databinding.ActivityChangePhoneNumberBinding
import com.ghn.cocknovel.ui.activity.setting.vm.ChangePhoneNumberViewModel

/**
 *@author: Administrator
 *2023/10/9
 *desc:修改手机号码
 */
class ChangePhoneNumberActivity : BaseHeadVMActivity<ChangePhoneNumberViewModel, ActivityChangePhoneNumberBinding, DefaultHeadStyle>() {
    override fun layoutId(): Int = R.layout.activity_change_phone_number

    override fun initView(savedInstanceState: Bundle?) {
        mHeadStyle.setLeftImageResource(R.mipmap.ic_back_black)
        mHeadStyle.setTitleBackgroundColor(getColor(R.color.colorBackGround))
        mHeadStyle.setTitleColor("修改手机号", getColor(R.color.black))
        mDatabind.btnSubmit.setOnClickListener {
            if (!TextUtils.isEmpty(mDatabind.edPhone.text.toString())) {
                mViewModel.getchangepathonenumber(mDatabind.edPhone.text.toString())
            }
            showMsg("提交")
        }
    }

    override fun createObserver() {
        mViewModel.changepathonenumber.observe(this) {
            showMsg("修改成功！")
            finish()
        }
    }

}